fldmeta_prop.func.ParallelGateway = {};

//on color change of ParallelGateway
fldmeta_prop.func.ParallelGateway.onDisplayStyle = function(elemid, rId, nv) {
	if (rId=="displayStyle_GradientColor0") {
		var grd = Snap("svg").select("#Gradient_"+elemid);
		grd && grd.remove();
		var c0 = nv || flstyle.elem.gradients.Gateway.a;
		var c2 = fl.curflow.bpmnConfig[elemid]["displayStyle_GradientColor2"]||flstyle.elem.gradients.Gateway.b;
		grd = Snap("svg").paper.gradient("r(0.5, 0.5, 0.5)"+c0+"-"+c2);
		grd.attr("id", "Gradient_"+elemid);
		Snap("g[data-element-id='"+elemid+"'] g.djs-visual polygon").attr({"fill" : "url(#Gradient_"+elemid+")"});
	} else if (rId=="displayStyle_GradientColor2") {
		var grd = Snap("svg").select("#Gradient_"+elemid);
		grd && grd.remove();
		var c0 = fl.curflow.bpmnConfig[elemid]["displayStyle_GradientColor0"]||flstyle.elem.gradients.Gateway.a;
		var c2 = nv || flstyle.elem.gradients.Gateway.b;
		grd = Snap("svg").paper.gradient("r(0.5, 0.5, 0.5)"+c0+"-"+c2);
		grd.attr("id", "Gradient_"+elemid);
		Snap("g[data-element-id='"+elemid+"'] g.djs-visual polygon").attr({"fill" : "url(#Gradient_"+elemid+")"});
	} else if (rId=="displayStyle_BorderEffect") {
		if (nv=='none' || !nv) {
			Snap("g[data-element-id='"+elemid+"'] g.djs-visual polygon").attr("filter", null);
		} else {
			Snap("g[data-element-id='"+elemid+"'] g.djs-visual polygon").attr("filter","url(#"+nv+")");
		}
	} else if (rId=="displayStyle_BorderStrokeWidth") {
		Snap("g[data-element-id='"+elemid+"'] g.djs-visual polygon").attr({"strokeWidth" : parseInt(nv)});
	} else if (rId=="displayStyle_BorderColor") {
		Snap("g[data-element-id='"+elemid+"'] g.djs-visual polygon").attr({"stroke" : nv});
	} else if (rId=="displayStyle_ActivityIconColor") {
		Snap("g[data-element-id='"+elemid+"'] g.djs-visual").selectAll("path").forEach(function(el){
			el.attr({"stroke" : nv || flstyle.elem.defaultGateWayIconColor, "fill" : nv || flstyle.elem.defaultGateWayIconColor});
		});
	} else if (rId=="displayStyle_fontColor") {
		var text = Snap("g[data-element-id='"+elemid+"_label'] g.djs-visual text");
		text && text.attr({"fill" : nv || flstyle.elem.defaultFontColor});
	}
};


//properties settings for ParallelGateway
fldmeta_prop.control.ParallelGateway = {
		"includes-properties" : {
			"common" : fldmeta_prop.common.all.properties,
			"gatewaycommon" : fldmeta_prop.common.gateway.properties
		},
		"properties" : {
		},
		"abandon-properties" : fldmeta_prop.func.getAbandonPropertiesForConditional,
		"styles" : {
			"displayStyle" : {
				"name" : fmd_i18n_prop_tip_customstyle,
				"img" : "css.png",
		    	"cellType" : {
		    		"type" : "coro",
		    		"options" : fmd_i18n_prop_displayStyle_vals
		    	},
		    	"value" : {"default":"theme"},
		    	"conditional-sub" : {
		    		"custom" : {
		    			"displayStyle_GradientColor0" : {
		        			"name" : fmd_i18n_prop_color0,
		    		    	"cellType" : "cp",
		    		    	"img" : "color.png",
		    		    	"value" : function() {return flstyle.elem.gradients.Gateway.a}
		        		},
		        		"displayStyle_GradientColor2" : {
		        			"name" : fmd_i18n_prop_color2,
		    		    	"cellType" : "cp",
		    		    	"img" : "color.png",
		    		    	"value" : function() {return flstyle.elem.gradients.Gateway.b}
		        		},
		        		"displayStyle_ActivityIconColor" : function() {
		    				var obj1 = MyUtilJs.copyObj(fldmeta_prop.common.predefined["displayStyle_ActivityIconColor"]);
		    				obj1.value["default"] = flstyle.elem.defaultGateWayIconColor;
		    				return obj1;
		    			},
		    			"displayStyle_fontColor" : fldmeta_prop.common.predefined["displayStyle_fontColor"],
		        		"displayStyle_BorderStrokeWidth" : function() {
		    				var obj1 = MyUtilJs.copyObj(fldmeta_prop.common.predefined["displayStyle_BorderStrokeWidth"]);
		    				obj1.value["default"] = flstyle.elem.attrs.parallelgateway.strokeWidth;
		    				return obj1;
		    			},
		    			"displayStyle_BorderColor" : function() {
		    				var obj1 = MyUtilJs.copyObj(fldmeta_prop.common.predefined["displayStyle_BorderColor"]);
		    				obj1.value["default"] = flstyle.elem.attrs.parallelgateway.stroke;
		    				return obj1;
		    			},
		        		"displayStyle_BorderEffect" : fldmeta_prop.common.predefined["displayStyle_BorderEffect"]
		    		}
		    	}
			}
		},
		"onApply" : function() {
		},
		"propDhxGridEvents" : {
			"onCellChanged" : function(rId,cId,nv) {
				fldmeta_prop.func.onCellChanged_common(rId,cId,nv,
						JSONSelect.match("."+rId, fldmeta_prop.control.ParallelGateway));
				fldmeta_prop.func.onCellChanged_stylecommon(rId,cId,nv);
			}
		}
	};


